<template>
    <div>
        <!-- <h3>当前最新的count值为:{{$store.state.count}}</h3> -->
        <h3>{{ $store.getters.showNum }}</h3>
        <button @click="addHandle">+1</button>
        <button @click="addHandle3">+1 延迟一秒加一</button>
        <button @click="addHandle2">+N</button>
        <button @click="addHandle4">+N 延迟二秒加N</button>
    </div>
</template>

<script>
export default {
  data () {
    return {

    }
  },

  mounted () {

  },

  methods: {
    addHandle () {
      this.$store.commit('add')
    },
    addHandle2 () {
      this.$store.commit('addN', 3)
    },
    addHandle3 () {
      this.$store.dispatch('addAsYnc')
    },
    addHandle4 () {
      this.$store.dispatch('addNAsYnc', 3)
    }
  }
}
</script>

<style  scoped>
button{
    margin-left: 5px;
}
</style>
